import re

def format_reward(completions,**kwargs):
    pattern = r"^<think>.*?</think>\s*<answer>.*?</answer>$"
    completion_contents = [completion[0]["content"] for completion in completions]
    matches = [re.match(pattern,content,re.DOTALL | re.MULTILINE)
               for content in completion_contents]
    return [1.0 if match else 0.0 for match in matches]